﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Sherwood.Content.UpdateScheduler;

namespace Sherwood.Samples.UpdateSchedulerService
{
    public partial class UpdateSchedulerService : ServiceBase
    {
        private readonly Scheduler _scheduler;

        public UpdateSchedulerService()
        {
            InitializeComponent();

            _scheduler = DependencyInjection.Resolve<Scheduler>();
        }

        protected override void OnStart(string[] args)
        {
            _scheduler.Start(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30));
        }

        protected override void OnStop()
        {
            _scheduler.Stop();
        }
    }
}
